# INSTALAÇÃO
sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils  virt-manager -y

# INSERINDO USER AO GRUPO
sudo adduser bluur libvirt
sudo adduser bluur kvm

# CONFERINDO O SERVIÇO
sudo systemctl status libvirtd
sudo systemctl start libvirtd
sudo systemctl enable libvirtd

# DESINSTALAR
*Caso deseje
rm -rf /var/lib/libvirt/qemu/channel/target
sudo apt purge qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager -y
sudo apt remove qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager -y

# ENTRE NO VIRT-MANGER E APAGUE A INTERFACE PADRAO
sudo virt-manager
> Edit > Connection Details

# DELETE TODAS REGRAS DO FIREWALL
sudo iptables -F
sudo iptables -X
sudo iptables -Z
sudo iptables -P INPUT ACCESS
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -t filter -F
sudo iptables -t filter -X
sudo iptables -t filter -Z
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -t nat -Z
sudo iptables -t mangle -F
sudo iptables -t mangle -X
sudo iptables -t mangle -Z
sudo iptables -t raw -F
sudo iptables -t raw -X
sudo iptables -t raw -Z

# DESABILITANDO OS SERVICOS
sudo systemctl status libvirtd.socket
sudo systemctl status libvirtd-admin.socket
sudo systemctl status libvirtd-ro.socket
sudo systemctl status libvirtd

sudo systemctl stop libvirtd.socket
sudo systemctl disable libvirtd.socket

sudo systemctl stop libvirtd-admin.socket
sudo systemctl disable libvirtd-admin.socket

sudo systemctl stop libvirtd-ro.socket
sudo systemctl disable libvirtd-ro.socket

sudo systemctl stop libvirtd
sudo systemctl disable libvirtd

# ATIVANDO OS SERVICOS
sudo systemctl enable libvirtd.socket
sudo systemctl start libvirtd.socket

sudo systemctl enable libvirtd-admin.socket
sudo systemctl start libvirtd-admin.socket

sudo systemctl enable libvirtd-ro.socket
sudo systemctl start libvirtd-ro.socket

sudo systemctl enable libvirtd
sudo systemctl start libvirtd

# IP FORWARD
echo 1  | sudo tee /proc/sys/net/ipv4/ip_forward
cat /proc/sys/net/ipv4/ip_forward

# CRIANDO O ARQUIVO DE INTERFACE
*Criar dentro ~/
nano br10.xml

<network>
    <name>br10</name>
    <forward mode='nat'>
        <nat>
            <port start='1024' end='65535'/>
        </nat>
    </forward>
    <bridge name='br10' stp='on' delay='0'/>
    <ip address='192.168.30.1' netmask='255.255.255.0'>
        <dhcp>
            <range start='192.168.30.50' end='192.168.30.200'/>
        </dhcp>
    </ip>
</network>

sudo virsh list --all;
sudo virsh net-define br10.xml;
sudo virsh net-start br10;
sudo virsh net-autostart br10;
ip addr show dev br10;
